<?php
use function util\excelParseFile;


$gAttrDesc = loadAttrDesc();


function loadAttrDesc(): array {
    $filename = DIR_DATA . 'attr_desc.xlsx';
    if (!file_exists($filename)) exit("attr_desc.php File [${filename}] Not Found");

    $data = excelParseFile($filename)[0];

    $attrs = [];
    for ($i = 3; $i < count($data); $i++) {
        $row = $data[ $i ];
        if (empty($row['label'])) continue;
        $attrs[ $row['label'] ] = $row['number'];
    }

    uksort($attrs, function ($k1, $k2) {
        return strlen($k1) >= strlen($k2) ? 1 : -1;
    });

    return $attrs;
}
